package com.danceforyou.${objectName?uncap_first}.service.impl;

import com.danceforyou.common.service.impl.BaseServiceImpl;
import com.danceforyou.${objectName?uncap_first}.dao.${objectName}DAO;
import com.danceforyou.${objectName?uncap_first}.model.${objectName}DO;
import com.danceforyou.${objectName?uncap_first}.service.${objectName}Service;
import com.danceforyou.${objectName?uncap_first}.vo.${objectName}VO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* 类名称：${objectName}ServiceImpl
* 创建人：danceforyou
* 创建时间：${nowDate?string("yyyy年MM月dd日")}
* 版本号：1.0v
*/
@Service("${objectName?uncap_first}Service")
<#if priColumn.dataType == "int">
public class ${objectName}ServiceImpl extends BaseServiceImpl<Integer, ${objectName}DO, ${objectName}VO, ${objectName}DAO> implements ${objectName}Service {
<#elseif priColumn.dataType == "bigint">
public class ${objectName}ServiceImpl extends BaseServiceImpl<Long, ${objectName}DO, ${objectName}VO, ${objectName}DAO> implements ${objectName}Service {
<#else>
public class ${objectName}ServiceImpl extends BaseServiceImpl<String, ${objectName}DO, ${objectName}VO, ${objectName}DAO> implements ${objectName}Service {
</#if>
    @Autowired
    private ${objectName}DAO ${objectName?uncap_first}DAO;

    @Override
    public ${objectName}DAO getDao() {
        return ${objectName?uncap_first}DAO;
    }

    @Override
    public void saveInfo(${objectName}DO ${objectName?uncap_first}) {
        this.insert(${objectName?uncap_first});
    }

    @Override
    public void updateInfo(${objectName}DO ${objectName?uncap_first}) {
        this.update(${objectName?uncap_first});
    }

    @Override
    public int deleteInfoByIds(String ids) {
        String[] idArr = ids.split(",");
        int i = 0;
        for (String id : idArr) {
            i += this.deleteById(id);
        }
        return i;
    }
}
